CISC 1110 Lab 23
Write a definition
for a class called vet_record that
consists of 3 parts: info about the animal, info about the owner, and the
balance due on the account. The info about the animal is stored in a class
called animal_info (described below)
and the info about the owner is stored in a class called owner_info (described below).
Start by drawing the tree structure for
class vet_record. Continue by creating
two classes, as explained below.
First, create a
class called animal_info to contain
information about the animal; this class has the following 4 parts:
· the name of the animal (like “Rover” or “Slime”)
· the type of animal (like “dog” or “cat” or “boa
constrictor”)
· the age of the animal (an integer, like 5 or 2)
· the weight of the animal in pounds (like 3.6 or
15.87)
Second, create a
class called owner_info to hold
information about the animal’s owner:
· the last name of the owner
· the phone number of the owner
Now create
the class vet_record by combining an
object of class animal_info, an object of
class owner_info, and the balance due
(explained below) which is NOT an object, but a variable.
The third part of vet_record is
the balance due on the account (a number like $26.50).
NEVER create
a class or subclass that contains only one item. If there is only one item, it
should be included by itself in the containing class.
After creating the class definition, write a
declaration for an array of objects of class vet_record.
Call it pet. Make it big enough to hold info on 100 pets.